package action;

import java.io.FileInputStream;
import java.util.Comparator;
import java.util.List;

import comparetor.CustomerComparetorByBirth;
import pojo.Customer;
import processor.DataProcessor;
import processor.impl.DataProcessorImpl;
import scanner.DataScanner;
import scanner.impl.DataScannerImpl;

public class DataProcessAction {
	private Comparator<Customer> comparator;
	private DataProcessor dp;
	private DataScanner scanner;
	private String format;
	public void action() throws Exception{
		format="xml";
		DataScanner scanner=new DataScannerImpl(new FileInputStream("data.txt"));
		comparator=new CustomerComparetorByBirth();
		List<Customer> list=scanner.scann();
		dp=new DataProcessorImpl(list, format);
		StringBuilder sb=dp.process(comparator);
		System.out.println(sb.toString());
	}
	
	
	public static void main(String[] args) throws Exception{
		new DataProcessAction().action();
	}
}
